package com.baizhi.feignclient.hystrix;

import com.baizhi.feignclient.HystrixClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class HystrixClientFallbackFactory implements FallbackFactory<HystrixClient> {

    @Override
    public HystrixClient create(Throwable throwable) {
        return new HystrixClient() {
            @Override
            public String demo(Integer id) {
                return "当前服务不可用，请稍后再试！ id：" + id;
            }
        };
    }
}
